import { BasicColumn, FormSchema } from '@/components/Table';
import { formatToDateTime } from '@/utils/dateUtil'

export const columns: BasicColumn[] = [
  {
    title: '名称',
    dataIndex: 'name',
    width: 200,
  },
  {
    title: '联系方式',
    dataIndex: ['detail', 'contact'],
    width: 200,
  },
  {
    title: '备注',
    dataIndex: 'remarks',
    width: 300,
  },
  {
    title: '创建时间',
    dataIndex: 'created_at',
    width: 180,
    customRender: ({ record }) => {
      return formatToDateTime(record.created_at);
    },
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'name',
    label: '名称',
    component: 'Input',
    colProps: { span: 8 },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'name',
    label: '名称',
    required: true,
    component: 'Input',
  },
  {
    label: '备注',
    field: 'remarks',
    component: 'InputTextArea',
  },
];
